package controller

import (
	"GinShop/service"
	"GinShop/utils"
	"github.com/gin-gonic/gin"
)

type FoodCategoryController struct {
}

func (fcc *FoodCategoryController) FoodCategory(ctx *gin.Context) {
	//调用service功能获取食品种类信息
	foodCategoryService := service.NewFoodCategoryService()
	categories := foodCategoryService.Categories()

	//转换格式
	//imgUrl: hello.png
	for _, category := range categories {
		if category.ImageUrl != "" { //图片url的拼接
			//category.ImageUrl = utils.FileServerAddr() + "/" + category.ImageUrl
		}
	}
	utils.Success(ctx, categories)
}
